package sctu.edu.java.year2016.team01.zhuming.day20160525.chapter6_2;

/**利用for循环和if语句去掉空格。
 * Created by Administrator on 2016/5/25.
 */
import java.util.Scanner;
public class KongGe {
    public static void main(String[] args) {

        System.out.println("请输入一串字符：");
        Scanner scan = new Scanner(System.in);
        String ch = scan.nextLine();

        String num = new String();


        for (int j = 0; j < ch.length(); j++) {
            if (ch.charAt(j) != ' ')
                num = num + ch.charAt(j);
        }
            System.out.println(num);
        }
    }